package com.bishe.demo.modules.hotel.hotelPolicy.dao;

import com.bishe.demo.modules.hotel.hotelPolicy.entity.Check;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface CheckDao {
    @Insert("insert into hotel_check values(null,#{checkInTime},#{checkOutTime})")
    @Options(useGeneratedKeys = true, keyProperty = "checkId", keyColumn = "check_id")
    void insertCheck(Check check);

    @Select("select * from hotel_check hc left join hotel_policy_check hpc on hpc.check_id=hc.check_id where hpc.policy_id=#{policyId}")
    Check getCheckByPolicyId(int policyId);

    @Delete("delete from hotel_check where check_id=#{checkId}")
    void deleteCheckByCheckId(int checkId);
}
